﻿<%@ Page Title="Hủy đăng ký bảo hành" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master"
    AutoEventWireup="true" CodeBehind="UnRegisterWarranty.aspx.cs" Inherits="PanasonicWarranty.UI.UnRegisterWarranty"  %>

<%@ Register Src="../UserControl/ucPaging.ascx" TagName="ucPaging" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CssContent" runat="server">
    <link href="../css/uploadify.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .table2 tr.notvalid td{background: #FC9C9C !important;}
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script src="../js/jquery.uploadify.js" type="text/javascript"></script>
    <script src="../js/pana_authorization.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            RegisterDialog();
            ComboBox("ddlSearchAgency,ddlSearchModel");
            DatePicker("txtSearchFromDate,txtSearchToDate");
            $("[id$=ddlSearchCategory]").closest("td").find(".custom-combobox-input").focus();
        });
        
        function ShowDiaglog(id) {
            $("[id$=txtLydo]").val("");
            $("[id$=ltr_validate]").html("");
            if (Check_Authorize("{'roles': " + JSON.stringify("Write") + "}")) {
                $("[id$=hdfID]").val(id);
                OpenDialog("dialog1", 500);
                return false;
            }
            else {
                jAlert("Bạn không có quyền thực hiện chức năng này!");
            }
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid">
                </div>
                <h1>Điều kiện tìm kiếm</h1>
                <div class="clear"></div>
            </div>
            <div class="block-fluid" style="padding: 10px 0px 5px 10px">
                <table width="100%" cellspacing="0" cellpadding="0" class="">
                    <tbody>
                        <tr>
                            <td>Điện thoại KH</td>
                            <td>
                                <asp:TextBox ID="TextBox1" runat="server" onkeypress="return ValidateKeypress(/\d+/,event);" />
                            </td>
                            <td>Model sản phẩm</td>
                            <td><asp:TextBox ID="txtSearchModel" runat="server" /></td>
                            <td>Số máy</td>
                            <td><asp:TextBox ID="txtSearchProductCode" runat="server" /></td>
                        </tr>
                        <tr>
                            <td>Đại lý nhắn tin</td>
                            <td><asp:DropDownList ID="ddlSearchAgency" runat="server" /></td>
                            <td>Ngày mua hàng</td>
                            <td><asp:TextBox ID="txtSearchFromDate" runat="server" /></td>
                            <td>Đến</td>
                            <td><asp:TextBox ID="txtSearchToDate" runat="server" /></td>
                        </tr>
                        <tr>
                            <td>Điện thoại KH</td>
                            <td>
                                <asp:TextBox ID="txtSearchPhone" runat="server" onkeypress="return ValidateKeypress(/\d+/,event);" />
                            </td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td><td>&nbsp;</td>
                        </tr>
                    </tbody>
                </table>
                <div style="text-align:center; color:Red">
                    <asp:UpdatePanel ID="udpn3" runat="server">
                        <ContentTemplate>
                            <asp:Literal ID="ltrMsg" runat="server" EnableViewState="false" />
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
                <div style="text-align: center">
                    <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" OnClick="btnSearch_Click"
                        CssClass="btn" />
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid"></div>
                <h1>Danh sách sản phẩm đăng ký bảo hành</h1>
                <div class="clear"></div>
            </div>
            <asp:UpdatePanel ID="udpn1" runat="server">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                </Triggers>
                <ContentTemplate>
                    <div class="block-fluid table-sorting">
                        <div class="dataTables_wrapper" id="tSortable_wrapper">
                            <div class="dataTables_length">
                                <label>
                                    Hiển thị
                                    <asp:DropDownList ID="tSortable_length" size="1" aria-controls="tSortable" runat="server"
                                        OnSelectedIndexChanged="tSortable_length_SelectedIndexChanged" AutoPostBack="true">
                                        <asp:ListItem Value="5" />
                                        <asp:ListItem Value="10" />
                                        <asp:ListItem Value="25" />
                                        <asp:ListItem Value="50" Selected="True" />
                                        <asp:ListItem Value="100" />
                                        <asp:ListItem Value="200" />
                                        <asp:ListItem Value="250" />
                                        <asp:ListItem Value="300" />
                                        <asp:ListItem Value="400" />
                                        <asp:ListItem Value="500" />
                                    </asp:DropDownList>
                                    dòng</label>
                            </div>
                            <div>
                                <uc1:ucPaging ID="pagingtop" runat="server" />
                            </div>
                            <asp:GridView ID="grvData" CssClass="table2 dataTable" runat="server" 
                                AutoGenerateColumns="false" Width="100%" ShowHeaderWhenEmpty="true">
                                <Columns>
                                    <asp:TemplateField HeaderText="STT" ItemStyle-CssClass="STT">
                                        <ItemTemplate>
                                            <%#(Container.DataItemIndex + 1) + (pagingtop.CurrentPage - 1) * pagingtop.PageSize%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Đại lý">
                                        <ItemTemplate>
                                            <%#pa_Agency.GetAgencyName(Eval("AgencyID"))%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="Điện thoại KH" DataField="CustomerPhone" ItemStyle-CssClass="Phone"/>
                                    <asp:BoundField HeaderText="Model" DataField="ModelCode" ItemStyle-CssClass="width1"/>
                                    <asp:BoundField HeaderText="Số máy" DataField="ProductCode" ItemStyle-CssClass="width1"/>
                                    <asp:BoundField HeaderText="Ngày mua hàng" DataField="RegisterDate" DataFormatString="{0:d}" ItemStyle-CssClass="DateTime"/>
                                    <asp:BoundField HeaderText="Ngày ĐK" DataField="CreatedDate" DataFormatString="{0:d}" ItemStyle-CssClass="DateTime"/>
                                    <asp:BoundField HeaderText="Loại ĐK" DataField="WarrantyType" ItemStyle-CssClass="DateTime" />
                                    <asp:BoundField HeaderText="ĐK qua" DataField="RegisteredFrom" ItemStyle-CssClass="DateTime"/>
                                    <asp:BoundField HeaderText="Thời hạn bảo hành" DataField="Description" ItemStyle-CssClass="Description"/>
                                    <asp:TemplateField HeaderText="Chức năng" ItemStyle-CssClass="width7 align_center">
                                        <ItemTemplate>
                                            <a href="#" onclick='return ShowDiaglog(<%#Eval("WarrantyDetailID")%>);'>Hủy bảo hành</a>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                            <div class="dataTables_info" id="tSortable_info">
                                <asp:Literal ID="ltrInfo" runat="server" />
                            </div>
                            <div class="dataTables_paginate paging_full_numbers" id="tSortable_paginate">
                                <uc1:ucPaging ID="pagingbottom" runat="server" />
                            </div>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>
    <div class="dialog" id="dialog1" title="Hủy đăng ký bảo hành" style="display: none;">
        <div class="block">
            <asp:UpdatePanel ID="udpn2" runat="server">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnUnregister" EventName="Click" />
                </Triggers>
                <ContentTemplate>
                    <asp:HiddenField ID="hdfID" runat="server" Value="0" />
                    <table width="100%">
                        <tr>
                            <td width="150px">Lý do hủy</td>
                            <td><asp:TextBox ID="txtLydo" runat="server" TextMode="MultiLine" /></td>
                            <td width="20px"><span style="color:Red"><asp:Label ID="ltr_validate" runat="server" EnableViewState="false" /></span></td>
                        </tr>
                        <tr>
                            <td>Gửi tin nhắn thông báo</td>
                            <td><asp:CheckBox ID="chkSendMsg" runat="server" Checked="true" /></td>
                            <td>&nbsp;</td>
                        </tr>
                    </table>
                    <div style="text-align:center; color:Red">
                        <asp:Literal ID="ltrResult" runat="server" Text="" EnableViewState="false" />
                    </div>
                    <div class="dr"><span></span></div>
                </ContentTemplate>
            </asp:UpdatePanel>
            <div style="text-align: right">   
                <asp:Button ID="btnUnregister" runat="server" OnClick="btnUnregister_Click" CssClass="btn" Text="Hủy bảo hành" />           
                <input type="button" class="btn" value="Đóng" onclick="$('#dialog1').dialog('close'); return false;"/>
            </div>
        </div>
    </div>
    <asp:UpdateProgress ID="prg" runat="server" DisplayAfter="500">
        <ProgressTemplate>
            <div class="ui-widget-overlay ui-front" style="z-index:1003;">
                <img src='<%=ResolveUrl("~/images/loading.gif")%>' alt="Loading..." style="position: fixed; top: 50%; left: 50%;" />
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <div class="ui-widget-overlay ui-front" id="progress" style="display:none; z-index:1003;">
        <img src='<%=ResolveUrl("~/images/loading.gif")%>' alt="Loading..." style="position: fixed; top: 50%; left: 50%;" />
    </div>
</asp:Content>
